home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / libcruft / lapack / zgesv.f < prev    next >
Text File  |  1996-07-19  |  3KB  |  109 lines

  1.       SUBROUTINE ZGESV( N, NRHS, A, LDA, IPIV, B, LDB, INFO )
  2. *
  3. *  -- LAPACK driver routine (version 2.0) --
  4. *     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  5. *     Courant Institute, Argonne National Lab, and Rice University
  6. *     March 31, 1993
  7. *
  8. *     .. Scalar Arguments ..
  9.       INTEGER            INFO, LDA, LDB, N, NRHS
  10. *     ..
  11. *     .. Array Arguments ..
  12.       INTEGER            IPIV( * )
  13.       COMPLEX*16         A( LDA, * ), B( LDB, * )
  14. *     ..
  15. *
  16. *  Purpose
  17. *  =======
  18. *
  19. *  ZGESV computes the solution to a complex system of linear equations
  20. *     A * X = B,
  21. *  where A is an N-by-N matrix and X and B are N-by-NRHS matrices.
  22. *
  23. *  The LU decomposition with partial pivoting and row interchanges is
  24. *  used to factor A as
  25. *     A = P * L * U,
  26. *  where P is a permutation matrix, L is unit lower triangular, and U is
  27. *  upper triangular.  The factored form of A is then used to solve the
  28. *  system of equations A * X = B.
  29. *
  30. *  Arguments
  31. *  =========
  32. *
  33. *  N       (input) INTEGER
  34. *          The number of linear equations, i.e., the order of the
  35. *          matrix A.  N >= 0.
  36. *
  37. *  NRHS    (input) INTEGER
  38. *          The number of right hand sides, i.e., the number of columns
  39. *          of the matrix B.  NRHS >= 0.
  40. *
  41. *  A       (input/output) COMPLEX*16 array, dimension (LDA,N)
  42. *          On entry, the N-by-N coefficient matrix A.
  43. *          On exit, the factors L and U from the factorization
  44. *          A = P*L*U; the unit diagonal elements of L are not stored.
  45. *
  46. *  LDA     (input) INTEGER
  47. *          The leading dimension of the array A.  LDA >= max(1,N).
  48. *
  49. *  IPIV    (output) INTEGER array, dimension (N)
  50. *          The pivot indices that define the permutation matrix P;
  51. *          row i of the matrix was interchanged with row IPIV(i).
  52. *
  53. *  B       (input/output) COMPLEX*16 array, dimension (LDB,NRHS)
  54. *          On entry, the N-by-NRHS matrix of right hand side matrix B.
  55. *          On exit, if INFO = 0, the N-by-NRHS solution matrix X.
  56. *
  57. *  LDB     (input) INTEGER
  58. *          The leading dimension of the array B.  LDB >= max(1,N).
  59. *
  60. *  INFO    (output) INTEGER
  61. *          = 0:  successful exit
  62. *          < 0:  if INFO = -i, the i-th argument had an illegal value
  63. *          > 0:  if INFO = i, U(i,i) is exactly zero.  The factorization
  64. *                has been completed, but the factor U is exactly
  65. *                singular, so the solution could not be computed.
  66. *
  67. *  =====================================================================
  68. *
  69. *     .. External Subroutines ..
  70.       EXTERNAL           XERBLA, ZGETRF, ZGETRS
  71. *     ..
  72. *     .. Intrinsic Functions ..
  73.       INTRINSIC          MAX
  74. *     ..
  75. *     .. Executable Statements ..
  76. *
  77. *     Test the input parameters.
  78. *
  79.       INFO = 0
  80.       IF( N.LT.0 ) THEN
  81.          INFO = -1
  82.       ELSE IF( NRHS.LT.0 ) THEN
  83.          INFO = -2
  84.       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
  85.          INFO = -4
  86.       ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
  87.          INFO = -7
  88.       END IF
  89.       IF( INFO.NE.0 ) THEN
  90.          CALL XERBLA( 'ZGESV ', -INFO )
  91.          RETURN
  92.       END IF
  93. *
  94. *     Compute the LU factorization of A.
  95. *
  96.       CALL ZGETRF( N, N, A, LDA, IPIV, INFO )
  97.       IF( INFO.EQ.0 ) THEN
  98. *
  99. *        Solve the system A*X = B, overwriting B with X.
  100. *
  101.          CALL ZGETRS( 'No transpose', N, NRHS, A, LDA, IPIV, B, LDB,
  102.      $                INFO )
  103.       END IF
  104.       RETURN
  105. *
  106. *     End of ZGESV
  107. *
  108.       END
  109.